<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<head>
    <link rel="stylesheet" type="text/css" href="/css/style_member.css" />
    <title>会员注册-笔飞美术作品</title>
    	<%@include file="../common/js.jsp"%>
    <%@include file="../common/jspcommon.jsp"%>
	<%@include file="../common/css.jsp"%>

	<script type="text/javascript" src="js/jquery.validate.js"></script>
</head>
<body>
<div id="box">
     <%@include file="../common/header.jsp"%>
    <div id="main_div">
        <div class="site_map"><a href="../index.html">首页</a> 》个人资料</div>
        <div id="member_div_2">
            <table cellpadding="0" cellspacing="0" class="member_table">
                <tr>
                    <td class="td_1" valign="top">
                        <div class="left_nav">
                      		 <ul>
	                            <li><a href="/member.htm">控制面板</a></li>
	                            <li	class="cur"><a href="/memberInfo.htm">个人资料</a></li>
	                            <li	><a href="/mOrders.htm">我的订单</a></li>
	                            <li><a href="/mMade.htm">我的定制</a></li>
	                            <li ><a href="/mActivity.htm">我的活动</a></li>
	                            <li><a href="/mHas.htm">关注收藏欣赏</a></li>
	                            <li><a href="mComment.htm">评论管理</a></li>
	                            <li><a href="mPay.htm">支付保证金</a></li>
	                        </ul>
                        </div>
                    </td>
                    <td class="td_2" valign="top">
                        <table cellpadding="3" cellspacing="1" class="member_table2" id="">
                            <tbody>
                               <tr class="td1">
                                    <td style="width:25%; height:50px;">
                                        <b><a href="/memberInfo.htm" >账户信息</a></b>
                                    </td>
                                    <td style="width:25%;">
                                        <b><a href="/mBank.htm" >银行帐号</a></b>
                                    </td>
                                    <td style="width:25%;">
                                        <b><a href="/mHobby.htm">我的喜好</a></b>
                                    </td>
                                    <td>
                                        <b><a href="/mAddress.htm" class="current">收货地址</a></b>
                                    </td>
                                </tr>
                                <tr class="td2">
                                    <td colspan="4">
                                      <c:forEach items="${addressList}" var="list" varStatus="vs">
	                                	<tr>
	                                    	<td colspan="9" class="td_headeradd td1">
	                                    	<label>${vs.count } </label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<label >
												${list.province}${list.city}${list.county}${list.address}(${list.addressName})收${list.phone}
											</label>
											&nbsp;&nbsp;&nbsp;
											<a href="/mAddressUpdate.htm?aid=${list.id}">修改</a>
	                             			</td>
	                               		 </tr>	
                               		 </c:forEach>
                               <form  id="newAddressForm"  method="post">
                                  <table cellpadding="10" cellspacing="0" class="member_table3" >
                                        <tr>
                                            <td colspan="2" class="td44"> <span class="style5">新增收货地址</span>  <span class="style6 fr">* 为必填项</span>  </td>
                                        </tr>
                                        <tr>
                                            <td style="text-align:right;">*配送区域：</td>
                                            <td align="left">
		                                        <select name="show_data" tabindex="10" id="province"> </select>
		                                        <select name="show_data" tabindex="10" id="city"> </select>
		                                        <select name="show_data" tabindex="10" id="county"> </select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width:110px; text-align:right;">*收货人姓名：</td>
                                            <td align="left"><input type="text" class="input1" name="addressName" id="addressName" /></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align:right;">*电子邮箱地址：</td>
                                            <td align="left"><input type="text" class="input1" name="email" id="email"/></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align:right;">*详细地址：</td>
                                            <td align="left"><input type="text" class="input1" name="address" id="address"/></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align:right;">*邮政编码：</td>
                                            <td align="left"><input type="text" class="input1" name="zipcode" id="zipcode"/></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align:right;">*手机：</td>
                                            <td align="left"><input type="text" class="input1" name="phone" id="phone"/></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align:right;">*电话：</td>
                                            <td align="left"><input type="text" class="input1" name="telphone" id="telphone"/></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align:right;">*标志建筑：</td>
                                            <td align="left"><input type="text" class="input1" name="remark" id="remark"/></td>
                                        </tr>
                                        <tr>
                                            <td style="text-align:right;">*最佳送货时间：</td>
                                            <td align="left"><input type="text" class="input1" name="goodTime" id="goodTime"/></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td align="right"><input type="submit" name="Submit" value="" class="submit btn_special btn_xzshdz"/></td>
                                        </tr>
                               		 </table>
                               </form>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <%@include file="../common/footer.jsp" %>
    </div>
</div>

<script type="text/javascript">
initProvince('province', 'city','county');
	$("#newAddressForm").validate(
		{
			rules : {
				addressName : {
					required : true,
					minlength : 2,
					maxlength : 20
				},
				email : {
					required : true,
					minlength : 2,
					maxlength : 20
				} ,
				address : {
					required : true,
					minlength : 2,
					maxlength : 20
				} ,
				zipcode : {
					required : true,
					minlength : 2,
					maxlength : 20
				} ,
				phone : {
					required : true,
					minlength : 2,
					maxlength : 20
				} ,
				telphone : {
					required : true,
					minlength : 2,
					maxlength : 20
				} ,
				remark : {
					required : true,
					minlength : 2,
					maxlength : 20
				} ,
				goodTime : {
					required : true,
					minlength : 2,
					maxlength : 20
				}
			},
			messages : {
				addressName : {
					required : "请填写开户人姓名",
					minlength : "长度为2～20位",
					maxlength : "长度为2～20位"
				},
				email:{
					required : "请填写邮箱",
					minlength : "长度为2～20位",
					maxlength : "长度为2～20位"
				},
				address:{
					required : "请填写地址",
					minlength : "长度为2～20位",
					maxlength : "长度为2～20位"
				},
				zipcode:{
					required : "请填写邮编",
					minlength : "长度为2～20位",
					maxlength : "长度为2～20位"
				},
				phone:{
					required : "请填写手机",
					minlength : "长度为2～20位",
					maxlength : "长度为2～20位"
				},
				telphone:{
					required : "请填写电话",
					minlength : "长度为2～20位",
					maxlength : "长度为2～20位"
				},
				remark:{
					required : "请填写编制建筑",
					minlength : "长度为2～20位",
					maxlength : "长度为2～20位"
				},
				goodTime:{
					required : "请填写最佳送货时间",
					minlength : "长度为2～20位",
					maxlength : "长度为2～20位"
				}
			},
			submitHandler : function() {
				$.post("saveAddress.htm", {
					provinceCode : $("#province").val(),
					cityCode : $("#city").val(),
					province : $("#province").find("option:selected").text(),
					city : $("#city").find("option:selected").text(),
					countyCode : $("#county").val(),
					county : $("#county").find("option:selected").text(),
					addressName : $("#addressName").val(),
					email : $("#email").val(),
					address : $("#address").val(),
					zipcode : $("#zipcode").val(),
					phone : $("#phone").val(),
					telphone : $("#telphone").val(),
					remark : $("#remark").val(),
					goodTime : $("#goodTime").val()
					}, function(data) {
						if (data == 'success') {
							alert("添加成功");
							window.location.href="/mAddress.htm"
						} else{
							alert("添加失败");
						}
					});
			}
		});
	</script>
</body>
</html>
